define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {

		function get_data_seckill_list(result) {
			if(false) {
				result = '{"success": true,"msg": "","result": {"act": [' +
					'{"act_id": "act_id_001","act_name": "新年秒杀","introduction": "元旦秒杀活动","store_id": "001","store_name": "上海五金店","start_time": "2017/01/01 09:00:00","end_time": "2017/01/31 09:00:00","image": {"id": "001","image": "./img/upload/pro-img02.jpg"}},' +
					'{"act_id": "act_id_002","act_name": "元旦秒杀","introduction": "元旦秒杀活动","store_id": "001","store_name": "北京五金店","start_time": "2017/01/01 09:00:00","end_time": "2017/01/31 09:00:00","image": {"id": "001","image": "./img/upload/pro-img02.jpg"}}]},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else
				return result;
		}
		
		//返回信息
		return {
			seckill_list: function(nPage,act_type,callback,calldone) {
				Http.post({
					method: 'marketing.seckill.viewlist',
					pagelimit: 10,
					nPage: nPage,
					picSize: 'CS',
					act_type:act_type
				}, function(result) {
					if(callback)
						callback(get_data_seckill_list(result).result,get_data_seckill_list(result).process_time);
				}, function(e) {

				}, function() {
					if(calldone)
					calldone();
				})
			},
			//轮播图
			getBannerList: function(callback) {
				Http.post({
					method: 'marketing.banner.getlist',
					act_type:2
				}, function(result) {
					if(callback) {
						callback(result);
					}
				}, function(e) {
					//请求异常
				}, function() {
					
				});
			}
			
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Seckill", factory);
});